package com.base.web.core.util.kafka;

import com.base.web.core.util.UuidUtil;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * Description: kafka消息封装类
 *
 * @Author: RenTie
 * @Date: 2018-08-20 14:27
 **/
public class KafkaMessage {

    private String id;
    //消息内容
    private Object Data;
    //发送时间
    private Date sendTime;


    public KafkaMessage() {
    }

    public KafkaMessage(Object data) {
        id = UuidUtil.getUUID32();
        Data = data;
        sendTime = new Date();
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Object getData() {
        return Data;
    }

    public void setData(Object data) {
        Data = data;
    }

    public Date getSendTime() {
        return sendTime;
    }

    public void setSendTime(Date sendTime) {
        this.sendTime = sendTime;
    }

    public static KafkaMessage initMeassage(Object data){
        return new KafkaMessage(data);
    }

    @Override
    public String toString() {
        return "KafkaMessage{" +
                "id='" + id + '\'' +
                ", Data=" + Data +
                ", sendTime=" + sendTime +
                '}';
    }
}
